package com.free.framework.lib.network;

import com.free.framework.lib.utils.LogHelper;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;


/**
 * @author 李博
 * @date 16/10/27
 * @desc
 */

public class SSLSocketFactoryGen {

    public static SSLSocketFactory genSSLSocketFactory() {
        SSLSocketFactory sslSocketFactory = null;
        try {
            SSLContext sslContext = SSLContext.getInstance("SSL");
            TrustManager[] trustManagers = new TrustManager[]{new FjrX509TrustManager()};
            sslContext.init(null, trustManagers, new java.security.SecureRandom());
            sslSocketFactory = sslContext.getSocketFactory();
        } catch (Exception e) {
            LogHelper.e("SSLSocketFactory -> " + e.getMessage());
        }
        return sslSocketFactory;
    }

}
